import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {path: '/', name: 'home',meta: {title: '首页'}, component: () => import('../views/home.vue')},
    {path: '/404', meta: {title: '没找到页面'}, component: () => import('../views/404.vue')},
    {path: '/:pathMatch(.*)', redirect: '/404'},
    
  ],
})
router.beforeEach((to, from, next) => {
  document.title = to.meta.title
  next()
})
export default router
